<?php
class classDeliveryType{
    public function getDeliveryList(){
        return $this->getComboBoxWithDelivery($this->getDataFromDB());
    }
    
    private function getDataFromDB(){
        $result = '';
        $sql_result = mysql_query('SELECT id,dt_name FROM delivery_types');
        while ($sql_obj = mysql_fetch_object($sql_result))
          $result[$sql_obj->id] .= $sql_obj->dt_name;
        return $result;
    }
    
    private function getComboBoxWithDelivery($asDeliveryList){
        $result = '
          '._i18n_order_SELECT_TYPE_OF_DELIVERY_.':
          <select 
            name="cbDeliveryType" 
            id="cbDeliveryType"
            onchange="
              document.getElementById(\'cbDeliveryType_Selected\').value = this.value;
              classPaimentType();
            "
          >
        ';
        $result .= '<option value ="0">'._i18n_order_SELECT_.'</option>';
        if($asDeliveryList!=''){
            foreach ($asDeliveryList as $key => $value) {
              $result .= '<option value ="'.$key.'">'.$value.'</option>';
            }
        }
        $result .= '</select>';
        
        return $result;
    }
}
?>

